Skip to content

Tolerate missing X-RateLimit-Remaining for custom base URLs (GHE) - #18

Merged
joaopamaral merged 1 commit into
masterfrom
fix/missing-ratelimit-header-custom-base-url
Jun 29, 2026
Merged

Tolerate missing X-RateLimit-Remaining for custom base URLs (GHE)#18
joaopamaral merged 1 commit into
masterfrom
fix/missing-ratelimit-header-custom-base-url

Conversation

@joaopamaral

Copy link
Copy Markdown

Problem

Discovery against a GitHub Enterprise instance (a custom base_url) fails even though the API call succeeds:

INFO METRIC: {"metric": "http_request_duration", ..., "http_status_code": 200, "status": "failed"}
CRITICAL The API call using the specified base url was unsuccessful. Please double-check the provided base URL.
tap_github.client.GithubException: The API call using the specified base url was unsuccessful. ...

The request returns 200, but the Enterprise instance has rate limiting disabled and does not send the X-RateLimit-Remaining response header. rate_throttling assumed a missing header means a bad base URL and raised — a false positive.

Change

rate_throttling now takes base_url and only raises on a missing X-RateLimit-Remaining header when the base URL is the default https://api.github.com. For a custom base URL (GitHub Enterprise), a missing header is expected on success, so throttling is skipped.

  • tap_github/client.py: add base_url param (defaults to DEFAULT_DOMAIN); authed_get_single_page passes self.base_url.
  • tests/unittests/test_rate_limit.py: add a case asserting no raise when the header is absent and a custom base URL is used (the existing default-domain case still raises).
  • Bump version 2.0.15 -> 2.0.16.

GitHub Enterprise (a custom base_url) can return a successful 200 without the
X-RateLimit-Remaining header when rate limiting is disabled. rate_throttling
treated the missing header as a bad base URL and raised GithubException,
breaking discovery against Enterprise instances.

Pass base_url into rate_throttling and only raise on a missing header for the
default github.com domain; for a custom base_url, skip throttling. Bump 2.0.16.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joaopamaral
joaopamaral requested a review from a team June 26, 2026 14:57

@peterbutler peterbutler left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@joaopamaral
joaopamaral merged commit 2aa3268 into master Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants